package com.guodi.model.feign;

import com.guodi.model.entity.ApiIdtIndicatorsDir;
import com.guodi.model.entity.IdtIndicators;
import com.guodi.model.entity.IdtTargetValue;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @描述: 指标目录远程调用
 * @作者: 余家鑫
 * @日期: 2021/4/21 上午10:04
 */
@FeignClient(
        value = "onemap-model"
        //, url = "http://10.0.1.247:6087"
        //, fallback = IOaClientFallback.class
)
public interface IIdtIndicatorsDirClient {
    String API_PREFIX = "/idtIndicatorsDirClient";
    String TREE_DATA_BY_CODE = API_PREFIX + "/treeDataByCode";
    String GET_DIR_ID_BY_TYPE_CODE = API_PREFIX + "/getDirIdByTypeCode";
    String LIST_ALL_BY_ID = API_PREFIX + "/listAllById";
    String GET_PLAN_TARGET_YEAR_BY_INDICATOR_ID = API_PREFIX + "/getPlanTargetYearByIndicatorId";
    String MAP_INDICATORS_CODE_2_ID = API_PREFIX + "/mapIndicatorsCode2Id";
    String MAP_INDICATORS_ID_2_ENTITY = API_PREFIX + "/mapIndicatorsId2Entity";
    String MAP_CODE_2_IDT_INDICATORS = API_PREFIX + "/mapCode2IdtIndicators";
    String LIST_IDT_TARGET_VALUE_BY_DIVISION_CODE = API_PREFIX + "/listIdtTargetValueByDivisionCode";
    String MAP_INDICATORS_ID_2_NAME = API_PREFIX + "/mapIndicatorsId2Name";
    String MAP_INDICATORS_ID_2_UNIT = API_PREFIX + "/mapIndicatorsId2Unit";
    String MAP_INDICATORS_NAME_2_CODE = API_PREFIX + "/mapIndicatorsName2Code";

    /**
     * @描述: 根据数据, 查询指标目录数据
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/4/21 上午10:16
     */
    @PostMapping(TREE_DATA_BY_CODE)
    List<ApiIdtIndicatorsDir> treeDataByCode(@RequestParam("code") String code
            , @RequestParam("areaCode") String areaCode
            , @RequestParam("year") String year);

    /**
     * @描述:
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/4/21 下午12:33
     */
    @PostMapping(GET_DIR_ID_BY_TYPE_CODE)
    String getDirIdByTypeCode(@RequestParam("typeCode") String typeCode);

    /**
     * @描述: 根据id, 获取指标数据
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/4/21 下午12:33
     */
    @PostMapping(LIST_ALL_BY_ID)
    List<ApiIdtIndicatorsDir> listAllById(@RequestParam("id") String id
            , @RequestParam("areaCode") String areaCode
            , @RequestParam("year") String year);


    /**
     * @描述: 根据指标id, 获取这个指标的规划目标年数据
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/4/21 下午2:38
     */
    @PostMapping(GET_PLAN_TARGET_YEAR_BY_INDICATOR_ID)
    Integer getPlanTargetYearByIndicatorId(@RequestParam("indicatorsId") String indicatorsId);

    /**
     * @描述: 根据指标编号列表, 获取指标编号到指标id的map
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/4/22 下午3:59
     */
    @PostMapping(MAP_INDICATORS_CODE_2_ID)
    Map<String, String> mapIndicatorsCode2Id(@RequestParam("indicatorsCodes") List<String> indicatorsCodes);

    /**
     * @return
     * @描述: 根据指标id列表, 获取指标id到指标的map
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/4/23 上午10:09
     */
    @PostMapping(MAP_INDICATORS_ID_2_ENTITY)
    Map<String, IdtIndicators> mapIndicatorsId2Entity(@RequestParam("indicatorsIds") List<String> indicatorsIds);

    /**
     * @描述: 获取编号到指标的map
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/4/23 下午5:35
     */
    @PostMapping(MAP_CODE_2_IDT_INDICATORS)
    Map<String, IdtIndicators> mapCode2IdtIndicators();

    /**
     * @描述: 获取某个区划的规划指标数据
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/4/23 下午5:36
     * @return
     */
    @PostMapping(LIST_IDT_TARGET_VALUE_BY_DIVISION_CODE)
    List<IdtTargetValue> listIdtTargetValueByDivisionCode(@RequestParam("divisionCode") String divisionCode);

    /**
     * @描述: 获取指标id到指标名字的map
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/4/25 下午3:26
     */
    @PostMapping(MAP_INDICATORS_ID_2_NAME)
    Map<String, String> mapIndicatorsId2Name(@RequestParam("indicatorsIds") String[] indicatorsIds);

    /**
     * @描述: 获取指标id到指标unit的map
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/4/28 上午9:10
     */
    @PostMapping(MAP_INDICATORS_ID_2_UNIT)
    Map<String, String> mapIndicatorsId2Unit(@RequestParam("indicatorsIds") String[] indicatorsIds);

    /**
     * @描述: 获取指标名字到指标code的map
     * @入参:
     * @出参:
     * @作者: 余家鑫
     * @日期: 2021/5/20 下午5:55
     */
    @PostMapping(MAP_INDICATORS_NAME_2_CODE)
    Map<String, String> mapIndicatorsName2Code(@RequestParam("indicatorsNames") String[] indicatorsNames);
}
